﻿namespace HuaWei.Windows.Forms
{
    using System;
    using System.Windows.Forms;

    public class MsgBox
    {
        public static DialogResult ShowError(Exception ex)
        {
            frmMsgBox box = new frmMsgBox();
            box.Text = "错误";
            box.Message = ex.Message;
            box.MessageDetail = ex.ToString();
            return box.ShowDialog();
        }

        public static DialogResult ShowError(string msg, Exception ex)
        {
            frmMsgBox box = new frmMsgBox();
            box.Text = "错误";
            box.Message = msg;
            box.MessageDetail = ex.Message + Environment.NewLine + ex.ToString();
            return box.ShowDialog();
        }

        public static DialogResult ShowMsg(string msg)
        {
            return MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
        }

        public static DialogResult ShowQuestion(string msg)
        {
            return MessageBox.Show(msg, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
        }

        public static DialogResult ShowQuestionEx(string msg)
        {
            return MessageBox.Show(msg, "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
        }

        public static DialogResult ShowWarning(string msg)
        {
            return MessageBox.Show(msg, "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
    }
}

